﻿using System;
using System.Collections.Generic;
using System.Text;

namespace SchEdu.Framework.DataModel
{
    class SPTComparer : Comparer<SchEduDataSet.OrderRow>
    {

        public override int Compare(SchEduDataSet.OrderRow x, SchEduDataSet.OrderRow y)
        {
            if (x.ProcessingTime < y.ProcessingTime)
            {
                return -1;
            }
            if (x.ProcessingTime > y.ProcessingTime)
            {
                return 1;
            }
            return 0;
        }
    }

    class EDDComparer : Comparer<SchEduDataSet.OrderRow>
    {

        public override int Compare(SchEduDataSet.OrderRow x, SchEduDataSet.OrderRow y)
        {
            if (x.DueDate < y.DueDate)
            {
                return -1;
            }
            if (x.DueDate > y.DueDate)
            {
                return 1;
            }
            return 0;
        }
    }

    class LPTComparer : Comparer<SchEduDataSet.OrderRow>
    {

        public override int Compare(SchEduDataSet.OrderRow x, SchEduDataSet.OrderRow y)
        {
            if (x.ProcessingTime > y.ProcessingTime)
            {
                return -1;
            }
            if (x.ProcessingTime < y.ProcessingTime)
            {
                return 1;
            }
            return 0;
        }
    }

    class WSPTComparer : Comparer<SchEduDataSet.OrderRow>
    {

        public override int Compare(SchEduDataSet.OrderRow x, SchEduDataSet.OrderRow y)
        {
            if (x.Weight / x.ProcessingTime > y.Weight / y.ProcessingTime)
            {
                return -1;
            }
            if (x.Weight / x.ProcessingTime < y.Weight / y.ProcessingTime)
            {
                return 1;
            }
            return 0;
        }
    }

    class OrderComparer : Comparer<SchEduDataSet.OrderRow>
    {

        public override int Compare(SchEduDataSet.OrderRow x, SchEduDataSet.OrderRow y)
        {
            if (x.ID < y.ID)
            {
                return -1;
            }
            if (x.ID > y.ID)
            {
                return 1;
            }
            return 0;
        }
    }

    class OperationComparer : Comparer<SchEduDataSet.OperationRow>
    {

        public override int Compare(SchEduDataSet.OperationRow x, SchEduDataSet.OperationRow y)
        {
            if (x.OrderID < y.OrderID)
            {
                return -1;
            }
            if (x.OrderID > y.OrderID)
            {
                return 1;
            }
            if (x.SequenceNo < y.SequenceNo)
            {
                return -1;
            }
            if (x.SequenceNo > y.SequenceNo)
            {
                return 1;
            }
            return 0;
        }
    }

}
